<div class="content-wrapper">

    <section class="content-header">
        <?=$this->partial('layout/breadcrumb')?>

        <h1 class="pull-right">
            <a href="<?=$this->url('p-order');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?=$this->translate('返回采购订单列表')?></a>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title"><?=$this->translate('查看采购订单');?></h3>
                    </div>

                    <div class="box-body">
                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('采购单号')?>：</b><?=$this->escapeHtml($this->orderInfo->getPOrderSn());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('订单状态')?>：</b><?=$this->PurchaseHelper()->orderState($this->orderInfo->getPOrderState(), 2);?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('付款方式')?>：</b><?=$this->PurchaseHelper()->orderPayment($this->orderInfo->getPaymentCode());?>
                                </div>
                            </div>

                        </div>

                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('供应商')?>：</b><?=$this->escapeHtml($this->orderInfo->getOneSupplier()->getSupplierName());?>
                                </div>
                            </div>
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('供应商联系人')?>：</b><?=$this->escapeHtml($this->orderInfo->getSupplierContacts());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('供应商手机')?>：</b><?=$this->escapeHtml($this->orderInfo->getSupplierPhone());?>
                                </div>
                            </div>

                        </div>

                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('供应商座机')?>：</b><?=$this->escapeHtml($this->orderInfo->getSupplierTelephone());?>
                                </div>
                            </div>
                            <div class="col-xs-8 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('备注')?>：</b><?=$this->escapeHtml($this->orderInfo->getPOrderInfo());?>
                                </div>
                            </div>

                        </div>


                        <div class="box-header">
                            <h4 class="box-title"><?=$this->translate('采购商品')?></h4>
                        </div>
                        <div class="box-body table-responsive no-padding">
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th width="15%"><?=$this->translate('商品编号')?></th>
                                    <th width="20%"><?=$this->translate('商品名称')?></th>
                                    <th><?=$this->translate('商品规格')?></th>
                                    <th><?=$this->translate('单位')?></th>
                                    <th><?=$this->translate('采购单价')?></th>
                                    <th><?=$this->translate('采购数量')?></th>
                                    <th><?=$this->translate('税金')?></th>
                                    <th width="10%"><?=$this->translate('采购总价')?></th>
                                </tr>
                                </thead>

                                <tbody>
                                <?php
                                foreach ($this->orderGoods as $goodsValue) {
                                    ?>
                                    <tr>
                                        <td><?=$this->escapeHtml($goodsValue->getGoodsNumber());?></td>
                                        <td><?=$this->escapeHtml($goodsValue->getGoodsName());?></td>
                                        <td><?=$this->escapeHtml($goodsValue->getGoodsSpec());?></td>
                                        <td><?=$this->escapeHtml($goodsValue->getGoodsUnit());?></td>
                                        <td><?=$this->erpCurrencyFormat($goodsValue->getPGoodsPrice());?></td>
                                        <td><?=$this->escapeHtml($goodsValue->getPGoodsBuyNum());?></td>
                                        <td><?=$this->erpCurrencyFormat($goodsValue->getPGoodsTax());?></td>
                                        <td><?=$this->erpCurrencyFormat($goodsValue->getPGoodsAmount());?></td>
                                    </tr>
                                <?php } ?>
                                </tbody>

                                <tfoot>
                                <tr>
                                    <td colspan="5"></td>
                                    <td colspan="2" class="text-right"><b><?=$this->translate('采购金额合计')?>：</b><span id="order-amount"><?=(isset($orderInfo) ? $this->erpCurrencyFormat($orderInfo->getPOrderAmount()) : 0)?></span></td>
                                </tr>
                                </tfoot>
                            </table>
                        </div>

                        <div class="box-header">
                            <h4 class="box-title"><?=$this->translate('操作记录')?></h4>
                        </div>
                        <div class="box-body table-responsive no-padding">
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th width="30%"><?=$this->translate('状态')?></th>
                                    <th width="30%"><?=$this->translate('操作人')?></th>
                                    <th width="40%"><?=$this->translate('操作时间')?></th>
                                </tr>
                                </thead>

                                <tbody>
                                <?php
                                foreach ($this->purchaseOperLog as $logValue) {
                                    ?>
                                    <tr>
                                        <td><?=$this->PurchaseHelper()->orderState($logValue->getOrderState(), 2);?></td>
                                        <td><?=$this->escapeHtml($logValue->getOperUser());?></td>
                                        <td><?=date("Y-m-d H:i:s", $logValue->getOperTime());?></td>
                                    </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                        </div>

                    </div>

                </div>


            </div>
        </div>

    </section>

</div>